﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Site.Domain.Core.Abstract;
using Site.Domain.Core.Concrete;
using Site.Domain.Core.Concrete.Layout;

namespace Site.Domain.Core
{
    public static class Factory
    {
        public static IBlock CreateBlock(string Name, string Title)
        {
            var defaultBlockMargin = Site.Core.Core.Configuration.DefaultBlockMargin;
            return new Block() { Name = Name, Title = Title, Margin = new Margin(defaultBlockMargin) };
        }

        public static IPage CreatePage(string Name, string Title)
        {
            var page = new Page() { Name = Name, Title = Title };
            page.Layout = GetLayoutByName(Site.Core.Core.Configuration.DefaultLayoutName, page);
            return page;
        }

        public static ILayout GetLayoutByName(string name, IPage page)
        {
            switch (name)
            {
                case "FlowLayout":
                    return new FlowLayout(name, page);
                case "StackLayout":
                    break;
            }
            return null;
        }
    }
}
